<template>
	<div class="w750" :class="Nomsg?'white-bg':''">
		<!-- 推广业绩 -->
		<div class="extension-achievement">
			<div class="extension-num">
				<div class="item-txt">
					<span class="txt-num">{{myPromoterUserData.monthTotal?myPromoterUserData.monthTotal:0}}</span>
					<span class="txt-span">本月发展会员</span>
				</div>
				<div class="item-txt">
					<span class="txt-num">{{myPromoterUserData.totalUser?myPromoterUserData.totalUser:0}}</span>
					<span class="txt-span">累计发展会员</span>
				</div>
			</div>
			<div class="add-up">
				<span class="txt">直接下级会员贡献佣金：</span>
				<span class="price">&#65509;<em class="now">{{Money(myPromoterUserData.firstDistCommis)[0]}}</em>.{{Money(myPromoterUserData.firstDistCommis)[1]}}</span>
			</div>
			<div class="extension-record">
				<div class="tit">
					<span class="item">会员手机号</span>
					<span class="item">注册时间</span>
					<span class="item">累计佣金(元)</span>
				</div>
			<template v-if="!Nomsg">
				<van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad" :immediate-check="false">
					<div class="con">
						<div class="item" v-for="(item,index) in (myPromoterUserData.appMyPromoterUserDtoList || '').resultList" :key="index">
							<span class="item-span">{{item.userMobile}}</span>
							<span class="item-span">{{item.parentBindingTime | dateformat('YYYY-MM-DD')}}</span>
							<span class="item-span">{{item.totalDistCommis!=0?item.totalDistCommis:'0.00'}}</span>
						</div>
					</div>
				</van-list>
			</template>
			<Noempty :pic="require('../../../assets/images/record-empty.png')" :title="'您还没有下级会员'" v-if="Nomsg"/>
			</div>
		</div>
		<!-- /推广业绩 -->
	</div>
</template>

<script>
import { myPromoterUser } from 'api/extensionApi';
import cash from 'utils/tool';
import Noempty from 'components/Noempty/Noempty';
export default {
    data () {
        return {
			Nomsg: false,
			Money: cash,
			myPromoterUserData:{},
			curPageNO:'1',
			loading: false,//下拉加载时用
			finished: false,//下拉加载时用
        }
	},
	mounted () {
    let that = this

		myPromoterUser({curPageNO:this.curPageNO}).then(res =>{
			if(res.status==1){
				if (res.result.appMyPromoterUserDtoList.resultList.length>0) {
					this.myPromoterUserData=res.result
				} else {
					this.Nomsg=true
				}
			}else{
				this.$toast({duration: 1000,message:res.msg})
				}
			});
	},
	methods: {
		onLoad() {//vant-list下拉加载方法
			setTimeout(() => {
				if((this.myPromoterUserData.appMyPromoterUserDtoList.resultList.length!=null)){
					if (this.myPromoterUserData.appMyPromoterUserDtoList.resultList.length >= this.myPromoterUserData.appMyPromoterUserDtoList.total) {
						this.loading = false
						this.finished = true
					} else {
						this.curPageNO++
						myPromoterUser({curPageNO:this.curPageNO}).then(res=> {
							for (let i = 0; i < res.result.resultList.length; i++) {
								this.myPromoterUserData.appMyPromoterUserDtoList.resultList.push(res.result.resultList[i])
							}
							// 加载状态结束
							this.loading = false;
						})
					}
				}
			}, 500);
		},
	},
	components: {
		Noempty
 	} ,
}
</script>

<style src="../../../assets/css/pre-deposit.css" scoped></style>

